package agents.messages;

import agents.agents.Receptionist;

import com.ibm.aglet.AgletProxy;
import com.ibm.aglet.Message;

public class RegisterServiceMessage extends BaseMessage
{
    private String _serviceName = "";
    private AgletProxy _offeringAgent = null;
    
    public RegisterServiceMessage()
    {	
    }
    
    public void setMessage(Message msg)
    {
	super.setMessage(msg);
	
	_serviceName = (String) getMessage().getArg("serviceName");
	_offeringAgent = (AgletProxy) getMessage().getArg("offeringAgent");
    }
    
    /**
     * @param props
     *            the properties of the host
     */
    public RegisterServiceMessage(String serviceName, AgletProxy offeringAgent)
    {
	_serviceName = serviceName;
	_offeringAgent = offeringAgent;
	getMessage().setArg("serviceName", _serviceName);
	getMessage().setArg("offeringAgent",_offeringAgent);
    }

   
    @Override
    public void sentTo(Receptionist agent)
    {
	agent.registerService(_serviceName, _offeringAgent);
    }
}
